package com.jt.www.enums.issue;

import org.apache.commons.lang3.StringUtils;

/**
 * 国寿财电子发票请求类型
 */
public enum InvoiceRequestTypeEnum {

    APPLY_INVOICE("13", "电子发票开票申请"),
    STATUS_QUERY_INVOICE("14", "电子发票开票状态查询"),
    WAIT_QUERY_INVOICE("15", "待开票数据查询");

    /**
     * 类型
     */
    private String type;
    /**
     * 描述
     */
    private String desc;

    InvoiceRequestTypeEnum(String type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    /**
     * 通过type得到描述
     *
     * @param type
     * @return
     */
    public static String getDescByType(String type) {
        if (StringUtils.isBlank(type)) {
            return "";
        }
        for (InvoiceRequestTypeEnum invoiceTypeEnum : InvoiceRequestTypeEnum.values()) {
            if (invoiceTypeEnum.type.equals(type)) {
                return invoiceTypeEnum.getDesc();
            }
        }
        return "";
    }

    public String getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }
}
